﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;
using Data.ModelDatabase;
using Shop.Mappers;

namespace Shop.Mappers
{
    public class WebMapper : IWebMapper
    {
        public List<Shop.Models.Product> Wrapper(List<Entity.Products.Product> products)
        {
            Mapper.CreateMap<Entity.Products.Product, Shop.Models.Product>();
            Mapper.CreateMap<Entity.Categories.Category, Shop.Models.Category>();

            return Mapper.Map<List<Entity.Products.Product>, List<Shop.Models.Product>>(products);
        }

        public Shop.Models.Product Wrapper(Entity.Products.Product product)
        {
            Mapper.CreateMap<Entity.Products.Product, Shop.Models.Product>();
            Mapper.CreateMap<Entity.Categories.Category, Shop.Models.Category>();

            return Mapper.Map<Entity.Products.Product, Shop.Models.Product>(product);
        }

        public Entity.Products.Product Wrapper(Shop.Models.Product product)
        {
            Mapper.CreateMap<Shop.Models.Product, Entity.Products.Product>();
            Mapper.CreateMap<Shop.Models.Category, Entity.Categories.Category>();

            return Mapper.Map<Shop.Models.Product, Entity.Products.Product>(product);
        }

        //
        public List<Shop.Models.Category> Wrapper(List<Entity.Categories.Category> products)
        {
            Mapper.CreateMap<Entity.Products.Product, Shop.Models.Product>();
            Mapper.CreateMap<Entity.Categories.Category, Shop.Models.Category>();

            return Mapper.Map<List<Entity.Categories.Category>, List<Shop.Models.Category>>(products);
        }

        public Shop.Models.Category Wrapper(Entity.Categories.Category product)
        {
            Mapper.CreateMap<Entity.Products.Product, Shop.Models.Product>();
            Mapper.CreateMap<Entity.Categories.Category, Shop.Models.Category>();

            return Mapper.Map<Entity.Categories.Category, Shop.Models.Category>(product);
        }

        public Entity.Categories.Category Wrapper(Shop.Models.Category product)
        {
            Mapper.CreateMap<Shop.Models.Product, Entity.Products.Product>();
            Mapper.CreateMap<Shop.Models.Category, Entity.Categories.Category>();

            return Mapper.Map<Shop.Models.Category, Entity.Categories.Category>(product);
        }
    }
}
